package dimension.starry.entity;

import net.minecraft.entity.attribute.ClampedEntityAttribute;
import net.minecraft.entity.attribute.EntityAttribute;
import net.minecraft.registry.Registries;
import net.minecraft.registry.Registry;

import java.util.Arrays;

public enum Attributes {

    MONSTER_LEVEL("monster_level",
        (new ClampedEntityAttribute("starry_dimension.attribute.monster_level", 0, 0, 100)).setTracked(true));

    private final String name;
    private final EntityAttribute attribute;

    Attributes(String name, EntityAttribute attribute) {
        this.name = name;
        this.attribute = attribute;
    }

    public static void onInitialize() {
        Arrays.stream(Attributes.values())
            .forEach(
                attribute -> Registry.register(Registries.ATTRIBUTE, attribute.getName(), attribute.getAttribute())
            );
    }

    public String getName() {
        return name;
    }

    public EntityAttribute getAttribute() {
        return attribute;
    }
}
